<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
%>

<!DOCTYPE html>
<html lang="zh-cn" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>云医通开放性接口平台</title>
<link rel="stylesheet" type="text/css" href="./css/mserver.css" />
<link rel="stylesheet" type="text/css" href="./css/calender.css" />
<link rel="stylesheet" type="text/css" href="./css/mserverother.css" />
<link rel="stylesheet" type="text/css" href="./css/tip-yellow.css" />
<link rel="stylesheet" type="text/css" href="./css/tip-darkgray.css" />
<link rel="stylesheet" type="text/css" href="./css/tableStyle.css" />
<script src="./js/jquery-1.8.0.min.js"></script>
<script src="./js/Common.js"></script>
</head>

<body>
	<div class="mserver imenu">
		<div class="header">
			<div class="inner cf" style="position: relative;">
				<a title="云医通开放性接口平台" href="Document.jsp">
					<h2>
						<span></span>
					</h2>
				</a>
				<ul>
					<li><a id="documentCenter" title="文档中心" target="_self">文档中心</a>
						<em style="display: block; margin-top: -1px; height: 8px;"></em></li>

					<li><a id="applicationCenter" href="javascript:void(0);"
						title="" target="_self">应用接入</a></li>
				</ul>
				<div class="ibtn">
					<a href="javascript:void(0);" title="登录" target="_self"
						class="btn_log"><span>登录</span></a> <a style="cursor: pointer;"
						title="设置个人信息" target="_self" class="btn_info"
						href="javascript:void(0);"><span>设置个人信息</span></a>
				</div>
				<div style="clear: right;"></div>
				<div class="ibtn"
					style="position: absolute; bottom: 0px; right: 0px;">
					<input id="txt_Search" type="text" /> <a
						href="javascript:SearchAPI();" title="查找" target="_self"
						class="btn_Search"><span>查找</span></a>
				</div>
			</div>
		</div>
		<input type="hidden" id="local_url" value="" />
		<div class="open_wrap">
			<div class="title_logo">
				<img src="./images/open_title.png" />
			</div>

			<div class="open_content">
				<div class="open_main clearfix">

					<div class="left">
						<div class="open2_menu_all">
							<h1>
								<a href="Document.jsp">返回文档中心 </a>
							</h1>
							<ul class="open2_menu" style="display: block;">
							</ul>
						</div>
					</div>
					<!-- end of left -->

					<div class="right">
						<div class="api_list">
							<h1 id="api_title">查找结果</h1>
							<ul id="api_q">
							</ul>
						</div>
						<ul class="detail_list">
							<li style="padding-bottom: 20px;">
								<div class="title">
									<h2>
										<a name="247">API列表</a>
									</h2>
									<%--<a class="show" style="cursor: pointer;">[隐藏]</a>--%>
								</div>
								<div class="theme_content" style="text-indent: 24px;">
									<p></p>
									<div>&nbsp;</div>
									<div>
										<table id="tb_apilist" width="100%"
											class="ke-zeroborder kindTable kindTable1">
											<tbody>
											</tbody>
										</table>
									</div>
									<p>&nbsp;</p>
									<a name="247" class="more"></a>
								</div>
							</li>
						</ul>
					</div>
					<!-- end of right -->

				</div>
				<!-- end of open_main -->
			</div>
			<!-- end of open_content -->
		</div>
		<!-- end of open_wrap -->

		<div class="footer" style="clear: both; margin-top: 600px;">
			<p>Copyright &copy; 广州云医科技有限公司 2015-2016, All Rights Reserved</p>
		</div>

		<a href="#" class="go_top"></a>
	</div>

	<script type="text/javascript">
		var q = '';
		function ApiClass_Callback(ret) {
			if (ret) {
				var open2_menu = '';

				for (var i = 0; i < ret.length; i++) {
					open2_menu += '<li><a id="apiclass_' + ret[i].apiclassid
							+ '" href="API.jsp?apiclassid='
							+ ret[i].apiclassid + '"><div>'
							+ ret[i].apiclassname + '</div></a></li>';
				}

				if ($.trim(open2_menu).length > 0) {
					$('.open2_menu').append(open2_menu);
				}
			}
		}

		function Api_Callback(ret) {
			if (ret) {
				var tb_apilist = '';
				for (var i = 0; i < ret.length; i++) {
					tb_apilist += '<tr><td><em></em><a target="_blank" href="ApiDetails.jsp?apiclassid='
							+ ret[i].apiclassid
							+ '&apiid='
							+ ret[i].apiid
							+ '">'
							+ ret[i].apidefine
							+ '</a></td><td>'
							+ ret[i].apiname + '</td></tr>';
				}

				if ($.trim(tb_apilist).length > 0) {
					$('#tb_apilist tbody').append(tb_apilist);
				}
			} else {
				$('#tb_apilist tbody').append('没有数据');
			}
		}

		function CheckUrl() {
			q = $.trim(Public.GetUrlParam('q'));
			if (q.length == 0) {
				return false;
			} else {
				$('#api_q').append('<li>以下是的 <span style="color: red; font: bolder 16px 宋体;">"' + q + '"</span> 查找结果</li>');
				return true;
			}
		}
		
		function SearchAPI() {
            var txt = $.trim($('#txt_Search').val());
            if (txt.length == 0)
                return;
            if (txt.length > 50) {
                alert('搜索文本长度不能大于50');
                return;
            }

            Public.Redirect('SearchApi.jsp?q=' + encodeURIComponent(txt), '_self');
        }

		$(function() {
			path = "<%=path%>/";
			Public.ajaxPost(window.parent.path + apis["getApiClass"], null,
					ApiClass_Callback, null);

			if (!CheckUrl()) {
				$('#tb_apilist tbody').append('没有数据');
				return;
			}

			Public.ajaxPost(window.parent.path + apis["getApi"] + "?apiname="
					+ encodeURIComponent(encodeURIComponent(q)), null,
					Api_Callback, null);

			$(".show").click(function() {
				Public.Fold(this);
			});
		});
	</script>

</body>
</html>